package cn.metafoo.web.controller;

import cn.metafoo.common.entity.R;
import cn.metafoo.web.dao.mysql.dept.DeptMapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.metafoo.common.entity.R.ok;


/**
 * @author lordgod
 */
@Slf4j
@Tag(name = "测试接口")
@RestController
@RequestMapping("/api/test")
public class TestController {

    @Autowired
    private DeptMapper deptMapper;

    @Operation(summary = "返回部门数量")
    @GetMapping("/helloWorld")
    public R<Long> testHello(){
        Long count = deptMapper.selectCount();
        log.debug(String.valueOf(count));
        return ok(count);
    }
}
